package com.atech.ebayadmin.system.util;

import java.util.List;

import com.atech.ebayadmin.merchandise.vo.RecordVO;
import com.google.gson.Gson;

public class JsonParser {
public static String blank = "";
public static String square_bracket_start = "[";
public static String square_bracket_end = "]";
public static String braces_start = "{";
public static String braces_end = "}";
public static String colon = ":";
public static String semicolon = ";";
public static String quotation_mark = "\"";

public static String convertRecordsToJson(List<RecordVO> reList){
Gson gson = new Gson();

String json = gson.toJson(reList);

return json;
}

public static String convertSearchCriteriaToJson(String[] selFilter){

if(null == selFilter || selFilter.length == 0){
return blank;
}

StringBuffer json = new StringBuffer(square_bracket_start);

for (String filterItem : selFilter){
json.append(braces_start);
json.append(quotation_mark);
json.append(filterItem);
json.append(quotation_mark);
json.append(braces_end);
}

json.append(square_bracket_end);

return json.toString();
}
}